import { createBrowserRouter } from 'react-router-dom';

import MainLayout from '../layouts/MainLayout';
import ManageLayout from '../layouts/ManageLayout';
import QuestionLayout from '../layouts/QuestionLayout';
import Home from '../pages/Home';
import Login from '../pages/Login';
import Register from '../pages/Register';
import Notfound from '../pages/Notfound';
import List from '../pages/manage/List';
import Trash from '../pages/manage/Trash';
import Star from '../pages/manage/Star';
import Edit from '../pages/question/Edit';
import Stat from '../pages/question/Stat';
import Test from '../pages/Test';
const router = createBrowserRouter([
	{
		path: '/',
		element: <MainLayout />,
		children: [
			{ path: '/', element: <Home /> },
			{ path: '/login', element: <Login /> },
			{ path: '/register', element: <Register /> },
			{
				path: '/manage',
				element: <ManageLayout />,
				children: [
					{ path: 'list', element: <List /> },
					{ path: 'trash', element: <Trash /> },
					{ path: 'star', element: <Star /> },
				],
			},

			{ path: '/*', element: <Notfound /> },
		],
	},
	{
		path: '/question',
		element: <QuestionLayout />,
		children: [
			{ path: 'edit/:id', element: <Edit /> },
			{ path: 'stat/:id', element: <Stat /> },
		],
	},
	{
		path: '/test',
		element: <Test />,
	},
]);

export default router;

export const LOGIN = '/login';
export const MANAGE_LIST = '/manage/list';
export const REGISTER = '/register';